home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: Class problem
- Date: Sat, 02 Mar 1996 16:04:23 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4h9rgv$1ug@news.halcyon.com>
- References: <4gv6j2$klv@news-e2b.gnn.com> <4h2bvs$pop@brtph500.bnr.ca>
- NNTP-Posting-Host: blv-pm2-ip16.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- oophelp@bnr.ca (OOP Helpline) wrote:
-
-
- >|> class addr_data:public name_data
- >|> {
- >|> public:
- >|> char street[25];
- >|> char city[15];
- >|> char state[3];
- >|> int zip[11];
- >|> int phone[10];
- >|> }addr;
- >|>
- >|> Can someone please tell me what is wrong with this picture? I
- >|> appreciate it.
-
- >I see at least a half a dozen conceptual problems, such as improper
- >inheritance, lack of encapsulation, lack of aggregation...
-
- >Just because you can get your C++ code to compile or even to run does
- >not mean you are doing it right.
-
- This is what you get if you contact the "OOP Helpline?"
- Lost your job on the Suicide-Prevention Helpline, did you?
-
- What, besides the spurious trailing addr, is really wrong with this?
- You're throwing around sanctimonious terms like "improper inheritence"
- and "lack of aggregation," but you fail to show why inheriting from
- something publicly would ever be improper, and why adding adress and
- phone number to name isn't aggregation.
-
- I'll grant you one objection: "encapsulation" dictates one should
- access all these fields via methods instead of directly, and moreover
- the member variables should be protected or better. However, if you
- were sending this data to your SQL-server, you might send it in a
- struct exactly like this.
-
- What's wrong with this picture is struct implies no methods, class
- implies methods and that's what get's OOP Helplines pissed.
-
- --Norm
-
-